package com.ruijie.autotest.log.impl.parse;

import com.minelx.landisk.filesystem.core.File;
import com.ruijie.autotest.log.core.data.ITable;
import com.ruijie.autotest.log.impl.data.JsonTable;

import java.io.IOException;

public class JsonTableParser {
	private final File file;

	public JsonTableParser(File file) {
		this.file = file;
	}

	// FIXME 2021/1/7  wait for me!!!   another situation...
	// FIXME 2021/1/7  wait for me!!!   pull File parameter out as a field
	public ITable parseTable() {
		try {
			return new JsonTable(file.read());
		} catch (IOException e) {
			// FIXME 2021/1/4  wait for me!!!    duplicated with sibling
			throw new IllegalArgumentException("failed to parse: " + file);
		}
	}
}
